﻿namespace Crux.Core.Validations;
internal static class PrivateErrorHelpers
{
    internal static string Format(string format, params object[] arguments) => string.Format(CultureInfo.CurrentCulture, format, arguments);
    internal static Type TrimGenericWrapper(Type type, Type wrapper)
    {
        Type[] typeArgs;
        if (type.GetTypeInfo().IsGenericType &&
            type.GetGenericTypeDefinition() == wrapper &&
            (typeArgs = type.GetTypeInfo().GetGenericParameterConstraints()).Length == 1)
        {
            return typeArgs[0];
        }
        else
        {
            return type;
        }
    }
}
